{extend name="layouts/defatul" / }<!--模板继承defatul，减少代码复用-->

{block name="title"}首页{/block}

{block name="content"}
<?php if(isLogin()) :?>
<?php $user = loginUser();?>
<div class="row">
        <div class="col-md-8">
                {include file="layouts/_topic_form" /}
        </div>
        <div class=" col-md-4 d-flex flex-column justify-content-center align-items-center">
                <img src="{$user['avatar']}" alt="{$user['avatar']}" class="img-thumbnail" width="200" />
                <h4 class="p-4 " style="color: deeppink">{$user['name']}</h4>

                <div class="d-flex flex justify-content-center align-items-center  ">
                       <div class="d-flex flex-column justify-content-center align-items-center px-4 border-end">
                               <a href="{:url('user.followings',['id'=>$user['id']])}" class="text-success text-decoration-none">
                                       {$followings}
                               </a>
                               <span class="text-secondary" style="font-size: 13px">关注</span>
                       </div>

                        <div class="d-flex flex-column justify-content-center align-items-center px-4 border-end">
                                <a href="{:url('user.followers',['id'=>$user['id']])}" class="text-success text-decoration-none">{$followers}</a>
                                <span class="text-secondary" style="font-size: 13px">粉丝</span>
                        </div>

                        <div class="d-flex flex-column justify-content-center align-items-center px-4">
                                <a href="#" class="text-success text-decoration-none">{$topiccount}</a>
                                <span class="text-secondary" style="font-size: 13px">博文</span>
                        </div>
                </div>

        </div>

<!--        和个人中心的显示的博文类似-->
        {if $count > 0 }
        <div class="card col col-md-8">
                <div class="card-header text-center h5">
                        <i class="fa fa-list-ul text-success"   aria-hidden="true"></i>&nbsp;TA发的博文列表
                </div>
                <div class="card-body">

                        <ul class="list-group list-group-flush">
                                {foreach $topics as $topic}
                                {include file="topics/_topic" /}
                                {/foreach}
                        </ul>
                        <div class="pages d-flex justify-content-end align-items-center">
                                {$topics|raw}
                                <span class="count">总条数:{$count}</span>
                        </div>

                        {/if}
                </div>

        </div>

</div>
<?php else:?>
<div class="jumbotron bg-success text-white p-4 rounded">
        <h1 class="display-4">ThinkPHP8 入门实战项目</h1>
        <p class="lead">ThinkPHP 是一个免费开源的，快速、简单的面向对象的轻量级 PHP 开
                发框架，是为了敏捷 WEB 应用开发和简化企业应用开发而诞生的</p>
        <hr class="my-4">
        <p>ThinkPHP 诞生十七年来一直秉承简洁实用的设计原则，在保持出色的性能和至简
                代码的同时，更注重易用性。遵循 Apache2 开源许可协议发布，意味着你可以免费使用
                ThinkPHP，甚至允许把你基于 ThinkPHP 开发的应用开源或商业产品发布/销售。</p>
        <a class="btn btn-outline-warning btn-lg" href="{:url('User/create')}" role="button">现在注册</a>
</div>

<?php endif;?>
{/block}